package ksv.cron.v1;

import ksv.cron.CronContext;
import ksv.cron.CronModel;
import reactor.core.publisher.Mono;

import java.util.concurrent.BlockingQueue;

/**
 * @创建人 wsdc
 * @时间 2021/1/31
 * @描述 异常报警
 */
public interface CronMonitor {
    /**
     *  {@link #warn(CronContext, Exception)}           运行中出现的异常
     *  {@link #complete(CronContext)}                  当任务已经完结了
     *  {@link #containerInfo(CronContainer)}           定时报备 定时 任务容器的信息
     *  {@link #blockingQueueInfo(BlockingQueue)}       定时报备 回调队列里面的信息
     */
    default void warn(CronContext context, Exception e){

    }

    default void complete(CronContext context){

    }

    default void containerInfo(CronContainer cronContainer){

    }

    default void blockingQueueInfo(BlockingQueue queue){

    }

    CronMonitor empty = new CronMonitor() {
        @Override
        public void warn(CronContext context, Exception e) {

        }

        @Override
        public void complete(CronContext context) {

        }

        @Override
        public void containerInfo(CronContainer cronContainer) {

        }

        @Override
        public void blockingQueueInfo(BlockingQueue queue) {

        }
    };
}
